#Flask_WTF插件。后端
from flask import Flask,render_template,url_for
from forms import Login

app = Flask(__name__)
app.config['SECRET_EKY']='sadklfla3232'

@app.route('/')
def hello_world():
    return'Hello World!'

@app.route('/login')
def login():
    form = Login()
    if form.validate_on_submit():
        email = form.data['email']
        password = form.password.data
        nickname = form.nickname.data
    return render_template('login.html',form=form)

if __name__ == '__main__':
    app.run()

from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,SubmitField
from wtforms.validators import DataRequired,Email,length
class Login(FlaskForm):
    email = StringField('注册邮箱',validators=[DataRequired(),Email()],render_kw={'placeholder':'请填写邮箱'})
    password =PasswordField('密码',validators=[DataRequired()])
    nickname =StringField('昵称',validators=[length(1,10,message='请输入长度必须1-10个字符')])

    subim = SubmitField('提交')
